package Warning;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class WarnDialog extends ShowUI implements ActionListener {
    private boolean refuse = true;
    JButton y=new JButton("确定"),n=new JButton("取消");
    JFrame f;
    public WarnDialog(String title, String warn, JFrame j){
        super(title,warn);
        setVisible(false);
        setLayout(null);
        f=j;
        setSize(400,200);
        add(y);
        add(n);
        y.setBounds(70,80,80,60);
        n.setBounds(250,80,80,60);
        y.setFont(new Font("宋体",Font.BOLD,20));
        n.setFont(new Font("宋体",Font.BOLD,20));
        y.addActionListener(this);
        n.addActionListener(this);
    }
    public void actionPerformed(ActionEvent e){
        Object obj = e.getSource();
        if(obj==y){
            refuse = false;
            f.dispose();
            dispose();
        }
        if(obj==n)
            dispose();
    }
    public void Start(){
        setVisible(true);
    }
    public boolean Ans(){
        return refuse;
    }
}
